<?php
require('conn.php');
require('session.php');
require('functions.php');

//print_r($userdata);
 $rows=$mysql->query("select * from `jifen` order by `id` desc limit 0,10");	
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<title><?php echo $config['sitename']?>-任务赚钱</title>
<meta name="keywords" content="<?php echo $config['sitename']?>" />
<meta name="description" content="<?php echo $config['sitename']?>">
<link href="<?php echo $site?>/static/all.css" type="text/css" rel="stylesheet" media="all">
<script type="text/javascript" src="<?php echo $site?>/static/jquery.js"></script>

</head>

<body class="mhome">

<p>
  
  
  <!--<div class="nav"> 
	<div class="nav_box">
		<div class="nav_d" id="nav">
			<ul class="nav_u" id="scroller" >
			<?php
			$rows_type=$mysql->query("select * from `typedata` order by `id` desc");
			$count_type=count($rows_type);
			foreach($rows_type as $v_type){
				echo "<li><a href=\"?type={$v_type['id']}\">{$v_type['name']}</a></li>";
			}
			?>
			</ul>
		</div>
		<div class="sab arr" ><img src="<?php echo $site?>/static/index/jt.png" /><img src="<?php echo $site?>/static/index/jt1.png" style="display:none;" /></div>
	</div>
</div>-->
  
  <!-- Cesc -->
</p>
<p align="center"><img src="./static/img/gouwu.jpg" alt="" width="350" height="149"/>
  <script>
	$(function(){
		$(".arr").click(function(){
			var h = $("#nav").height();
			if(h==40){
				$("#nav").height($("#scroller").height()).css("overflow","visible");
			}else{
				$("#nav").height(40).css("overflow","hidden");
			}
		});
	})
</script>
</p>
<div class="list">

<!--<div class="gonggao">
	<p><a href="weixin.php">微信文章录入</a></p>
</div>-->


<?php
//转发多域名支持
$arr_sharesite=explode('#',$config['sharesite']);
$rand=array_rand($arr_sharesite);
$sharesite=$arr_sharesite[$rand];


foreach($rows as $row){
$row_pic=str_replace('[weixin]','http://img01.store.sogou.com/net/a/04/link?appid=100520031&w=135&h=90&url=',$row['pic']);
if($row['pv_max']=='-1'){
	$pv_max='无限投放';
}else{
	$pv_max=$row['pv_max'];
}

if($row['top']==1){
print <<<div
		<div class="list_d">
    	<a class="list_dd bor_b" href="jifenduihuan.php?aid={$row['id']}&uid={$userdata['id']}" target="_blank">
		<div class="list_lt">
			<dl class="list_ld">
				<dt><font color=red><b>[推荐]</b></font></dt>
				
				<!--<dd>阅读量：{$data['pv']}</dd>-->
			</dl>
		</div>
			<div align="center"><img src="{$row_pic}"  alt="" width="320" height="160"/></div>
		
		</a>
		</div>
div;
}else{
print <<<div
		<div class="list_d">
    	<a class="btn btn btn-smal" target="_blank" href="jifenduihuan.php?aid={$row['id']}&uid={$userdata['id']}" target="_blank">
		<div class="list_l"><img src="{$row_pic}" width="135" height="120"/></div>
		<div class="list_lt">
			<dl class="list_ld">
				<dt>{$row['title']}</dt>
                                
                <dt><font color=red>消耗：{$row['money']}元</dt>
				<dd>结束时间:{$row['endtime']}</dd>
				<dd></dd>
				<dt><a class="btn btn btn-smal" target="_blank" href="jifenduihuan.php?aid={$row['id']}&uid={$userdata['id']}" title="接受">我要兑换</a></dt>
				<!--<dd>阅读量：{$data['pv']}</dd>-->
			</dl>
		</div>
		</a>
		</div>
div;
}
}
$mysql->__destruct();
$mysql->close();
?>
	</div>
<!--
<div style="background:#fff;">
	<ul class="pager"><li class="previous"><a href="#">上一页</a></li> <li class='next'><a target='_self' href=?page=1>下一页</a></li> </ul>
</div>
-->
<br><br><br>


<script type="text/javascript">
$(function() {
			var page_num = 1;
			var ident = true;
			var height_rate = 1.8;
			$(window).scroll(function(){
				//if($(document).height() - $(window).scrollTop() < $(window).height()*height_rate){
				if($(document).scrollTop()>=$(document).height()-$(window).height() - 2500 && ident){
                     page_num = page_num + 1;
					 ident = false;
                     $.get("/getlist.php", { page: page_num ,typeid:<?php echo $typeid?>},function(response){
						ident = true;
						$(".list_d").last().after(response);
						// if(response == ''){
							// ident = false;
							// $("#box-more").html('完');
						// }
                     },'html' );
				}
             });
})
</script>

</body>
</html>

